<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="<?php echo base_url() ?>Resources/Admin/img/favicon.png">

    <title>List invoice</title>

    <!-- Bootstrap core CSS -->
    <link href="<?php echo base_url() ?>Resources/Admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php echo base_url() ?>Resources/Admin/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="<?php echo base_url() ?>Resources/Admin/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="<?php echo base_url() ?>Resources/Admin/css/style.css" rel="stylesheet">
    <link href="<?php echo base_url() ?>Resources/Admin/css/style-responsive.css" rel="stylesheet" />
    
  <link rel="stylesheet" href="<?php echo base_url() ?>Resources/Admin/js/autocomplete/jquery-ui.css">
<script src="<?php echo base_url() ?>Resources/Admin/js/jquery.js"></script>
  <script src="<?php echo base_url() ?>Resources/Admin/js/autocomplete/jquery-ui.js"></script>
    
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->  

        <style>
        #jquery_link{
        	margin-top:5px;	
        }
        </style>
  </head>

  <body>

  <section id="container" class="">
      <!--header start-->
      <header class="header white-bg">
           <?php $this->load->view('admin_layout/header') ?>
        </header>
      <!--header end-->
      <!--sidebar start-->
       <aside>
          <div id="sidebar"  class="nav-collapse ">
              <?php $this->load->view('admin_layout/sidebar') ?>
          </div>
      </aside>
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <!-- page start-->                      
              <div class="row">
              <div class="col-sm-12">
                      <section class="panel">
                          <header class="panel-heading">
                              Các hóa đơn đang chờ xử lý
                          </header>
                          <table class="table table-striped table-advance table-hover table-bordered">
                              <thead>
                              <tr>
                                  <th><i class="icon-bullhorn"></i>INVOICE_ID</th>
                                  <th>ACCOUNT</th>
                                  <th>INVOICE_TYPE</th>
                                  <th>START_DATE</th>
                                  <th>END_DATE</th>
                                  <th>APPROVAL_PERSON</th>
                                  <th class="hidden-phone"><i class="icon-question-sign"></i>PAYMENT_DESCRIPTION</th>
                                  <th><i class="icon-bookmark"></i>TOTAL</th>
                                  <th><i class=" icon-edit"></i>INVOICE_STATUS</th>
                                  <th></th>
                              </tr>
                              </thead>
                              <tbody>
                              <?php if(isset($info) && !empty($info)) {
                                foreach($info as $i) {
                                    
                                
                               ?>
                              <tr>
                                  <td><?php echo $i->INVOICE_ID ?></td>
                                  <td><?php 
                                  $user = $this->m_account->get_account_by_id($i->ACCOUNT_ID);
                                  
                                  echo $user->USERNAME;
                                  
                                  
                                   ?></td>
                                  <td><?php echo $i->INVOICE_TYPE ?></td>
                                  <td><?php echo $i->START_DATE ?></td>
                                  <td><?php echo $i->END_DATE ?></td>
                                  <td><?php echo $i->APPROVAL_PERSON ?></td>
                                  <td><?php echo $i->PAYMENT_DESCRIPTION ?></td>
                                  <td><?php echo $i->TOTAL ?></td>
                                  
                                 <?php if($i->INVOICE_STATUS == 1 || $i->INVOICE_STATUS == 2 || $i->INVOICE_STATUS == 3 || $i->INVOICE_STATUS == 4 || $i->INVOICE_STATUS == 5 ||
                                   $i->INVOICE_STATUS == 6 || $i->INVOICE_STATUS == 7 || $i->INVOICE_STATUS == 8 || $i->INVOICE_STATUS == 9 || $i->INVOICE_STATUS == 10 || $i->INVOICE_STATUS == 11
                             ) {  ?>
                                  <td><span class="label label-success label-mini"><?php 
                                  
                                           switch($i->INVOICE_STATUS)
                                        {
                                           case 1: echo 'Chưa thanh toán'; break;
                                           case 2: echo 'Đã thanh toán'; break;
                                           case 3: echo 'Đã thanh toán > Đang xử lí'; break;
                                           case 4: echo 'Đã thanh toán > Shipping'; break;
                                           case 5: echo 'Đã thanh toán > Đã xử lí > Chờ nhận hàng '; break; 
                                           case 6: echo 'Đã giao hàng '; break;
                                           case 7: echo 'Thanh toán an toàn (3 ngày) ';  break;
                                           case 8: echo 'Delay (Hết hàng, khách bị ban trade,...) ';  break;
                                           case 9: echo 'Pre-order'; break;
                                           case 10: echo 'Pre-order 1';  break;
                                           case 11: echo 'Pre-order 2';  break;
                                           case 12: echo 'Đã hoàn tất'; break;
                                           case 0: echo 'Đã hủy'; break;
                                        }
                                        
                                   ?></span></td> <?php } else if($i->INVOICE_STATUS == 12) { ?>
                                  
                                   <td><span class="label label-primary label-mini">Đã xử lý</span></td> <?php } 
                                   
                                   else if($i->INVOICE_STATUS == 0) { ?>
                                  
                                   <td><span class="label label-danger label-mini">Đã hủy</span></td> <?php } ?>
                                  
                                  <td>
                                      <a href="<?php echo base_url('invoice/chi_tiet/'.$i->INVOICE_ID) ?>"><button class="btn btn-primary btn-xs"><i class="icon-pencil"></i></button></a>
                                  </td>
                              </tr>
                              <?php }
                              } ?>
                              </tbody>
                          </table>
                          <div id="jquery_link" align="center">
                        		<?php echo $pagination;?>
                        	</div>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
      <!--main content end-->
      <!--footer start-->
       <footer class="site-footer">
           <?php $this->load->view('admin_layout/footer') ?>
      </footer>
      <!--footer end-->
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    
    <script src="<?php echo base_url() ?>Resources/Admin/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="<?php echo base_url() ?>Resources/Admin/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="<?php echo base_url() ?>Resources/Admin/js/jquery.scrollTo.min.js"></script>
    <script src="<?php echo base_url() ?>Resources/Admin/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="<?php echo base_url() ?>Resources/Admin/js/respond.min.js" ></script>

    <!--common script for all pages-->
    <script src="<?php echo base_url() ?>Resources/Admin/js/common-scripts.js"></script>
                                            <script type="text/javascript">
                                                		$("#price").keydown(function (e) {
                                                		//  alert('abc');
                                                		    // Allow: backspace, delete, tab, escape, enter and .
                                                		    if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
                                                		         // Allow: Ctrl+A
                                                		        (e.keyCode == 65 && e.ctrlKey === true) || 
                                                		         // Allow: home, end, left, right
                                                		        (e.keyCode >= 35 && e.keyCode <= 39)) {
                                                		             // let it happen, don't do anything
                                                		             return;
                                                		    }
                                                		    // Ensure that it is a number and stop the keypress
                                                		    if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
                                                		        e.preventDefault();
                                                		    }
                                                		});
                                                	</script>

  </body>
</html>